<%--
  Created by IntelliJ IDEA.
  User: Administrator
  Date: 2017/5/5
  Time: 11:01
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ page isELIgnored="false" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!--分页标签 -->
<%@ taglib prefix="page" uri="/xianzhiOA/pageTag" %>
<%@ taglib prefix="p" uri="/xianzhiOA/powerTag" %>
<html>
<head>
    <title>模板一览</title>
    <script type="application/javascript">
        function pToSub(page) {
            if (page != undefined) {
                var pageInp = document.getElementById("page");
                pageInp.value = page;
                var form = document.getElementById("templetForm");
                form.submit();
            }
        }

        //跳到创建模板的页面
        function ToAddTemplet() {
            var templetForm=document.getElementById("templetForm");
            templetForm.action="${pageContext.request.contextPath}/XzTempletBase/toTempletCreatPage.emp";
        }

        //删除模板
        function deleteCheck(templetBaseId) {
            if (confirm("确定要删除吗")) {
                var templetForm = document.getElementById("templetForm");
                window.location.href = "${pageContext.request.contextPath}/XzTempletBase/deleteTemplet.emp?templetBaseId=" + templetBaseId;

            }
        }

    </script>
</head>
<body>
<!--头部开始-->
<jsp:include page="headerBack.jsp"></jsp:include>
<!-- 导航 -->
<jsp:include page="leftBack.jsp"></jsp:include>
<!--内容页-->
<div class="main">

    <!--内容页头部-->
    <div class="page-header">
        <div class="pull-left">
            <ol class="breadcrumb visible-sm visible-md visible-lg">
                <li><a href="two.html"><i class="icon fa fa-home"></i>主页</a></li>
                <li class="active"><i class="fa fa-pencil"></i>基本信息</li>
            </ol>
        </div>
        <div class="pull-right">
            <h2>主页</h2>
        </div>
    </div>
  <form action="${pageContext.request.contextPath}/XzTempletBase/selTempletAll.emp" class="search1" method="post" id="templetForm">
      <div>
          <div>
              <p:power jspPower="模板管理：添加">
                  <button type="submit" class="three btn btn-primary" onclick="ToAddTemplet()">添加</button>
              </p:power>
              <a href="${pageContext.request.contextPath}/XzTempletBase/selTempletAll.emp" class="three btn btn-primary">重置</a>
          </div>
          <div style="margin-top: 10px">
              <input id="page" name="page" type="hidden" value="${page}">
              <input id="pages" name="pages" type="hidden" value="${pages}">

              <input type="text" placeholder="模板名称..." name="templetName" value="${xzTempletBase.templetName}">
              <button type="submit" class="one"><span class="fa fa-search"></span></button>
          </div>
      </div>
      <!--表格-->
      <div class="well">

          <table class="table" id="now">
              <thead>
              <tr>
                  <th class="d">编号</th>
                  <th class="d">模板名称</th>
                  <p:power jspPower="模板管理：修改">
                      <th class="dd">修改</th>
                  </p:power>
                  <p:power jspPower="模板管理：删除">
                      <th class="dd">删除</th>
                  </p:power>
              </tr>
              </thead>

              <tbody>


              <c:forEach var="templetbase" items="${templetBaseList}">
                  <tr>
                      <td>${templetbase.templetBaseId}</td>
                      <td>${templetbase.templetName}</td>
                      <p:power jspPower="模板管理：修改">
                      <td><a href="${pageContext.request.contextPath}/XzTempletBase/toUpdatePage.emp?templetBaseId=${templetbase.templetBaseId}"><i
                              class="fa fa-pencil"></i></a></td>
                      <!-- <td><a href="${pageContext.request.contextPath}/XzEmp/deleteEmp.emp?empId=${Emp.empId}" role="button" data-toggle="modal"><i class="fa fa-times"></i></a></td>  -->
                      </p:power>
                      <p:power jspPower="员工管理：删除">
                      <td><a onclick="deleteCheck(${templetbase.templetBaseId})" role="button" data-toggle="modal"><i
                              class="fa fa-times"></i></a></td>
                      </p:power>
                  </tr>
              </c:forEach>


              </tbody>
          </table>
      </div>

      <!--分页符-->
      <div style="float: right">
          <ul class="pagination">
              <page:paging length="10" page="${page}" pages="${pages}"/>
          </ul>
      </div>
  </form>
</div>

</body>
</html>
